import java.util.*;

public class _12101 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String a1 = new String();
        a1 = in.nextLine();
        int n = a1.length();
        int c=0,flag=0;
        if(a1.charAt(0)>='A'&&a1.charAt(0)<='Z'){
            c++;
        }
        for(int i=1;i<n-1;i++){
            if(a1.charAt(1)=='0'){
                flag=1;
                break;
            }
            
            if(a1.charAt(i)<='0'||a1.charAt(i)>='9'){
                flag=1;
                break;
            }
        }
        if(n-2!=6){
            flag=1;
        }
        
        if(flag==0&&a1.charAt(n-1)>='A'&&a1.charAt(n-1)<='Z'){
            c++;
        }
        if(c==2){
            System.out.println("Yes");
        }else {
            System.out.println("No");
        }
    }
}
